/*
libhd44780fw C++ wrapper.
Copyright (C) 2011  Philippe Proulx (eeppeliteloop@gmail.com)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _HD44780FW_CPPWRAPPER_HPP
#define _HD44780FW_CPPWRAPPER_HPP

#include <avr/io.h>

#include "hd44780fw.h"
#include "hd44780_low.h"

// C++ wrapper for HD44780 framwork:
class hd44780 {
	public:
	hd44780(const struct hd44780fw_conf* conf);
	void init(void);
	void put(char ch);
	void write(const char* msg, uint8_t index, uint8_t cb);
	void clear(void);
	void en_blink(bool state);
	void en_cursor(bool state);
	void set_bc_index(uint8_t index);
	void build_cc(uint8_t index, const uint8_t* rows);
	hd44780& operator<<(const char* msg);
	hd44780& operator<<(uint16_t u);
	hd44780& operator<<(uint8_t u);
	hd44780& operator<<(int16_t i);
	hd44780& operator<<(int8_t i);
	hd44780& operator<<(char ch);
	const char* operator=(const char* msg);
	void operator-=(uint8_t rem);
	
	private:
	struct hd44780fw_conf fw_conf;
	struct hd44780_l_conf low_conf;
	hd44780(const hd44780&);		// Copy protection
	hd44780& operator=(const hd44780&);	// Copy protection
};

#endif // _HD44780FW_CPPWRAPPER_HPP
